<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="Keywords" content="">
    <title></title>
  </head>
  <body>
    
  </body>
</html>
<script>
  class Animal{
    constructor(type){
      this.type = type
    }
    say(){
      console.log("我是",this.type);
    }
    static sleep(){
      console.log("睡觉");
    }
  }
  let a = new Animal("哺乳动物")
  a.say()
  Animal.sleep()

  class Cat extends Animal{
    constructor(type,favaritefood){
      super(type)
      this.favaritefood = favaritefood
    }
  }
  let c = new Cat("哺乳动物+1","鱼")
  c.say()
  Cat.sleep()

//class其实他是一个语法糖，他本质是一个构造函数
  console.log(typeof Animal);
  
</script>